import { createApp } from 'vue'
import 'element-plus/dist/index.css'
import 'vant/lib/index.css';
import '../src/utils/vconsole'
import "./assets/style/index.css"
import locale from 'element-plus/es/locale/lang/zh-cn'
import App from './App.vue'
import router from "./router/index"
import piniaPluginPersist from 'pinia-plugin-persist'
import { createPinia } from 'pinia'
import Varlet from '@varlet/ui'
import $ from "jquery"
import vueEsign from "vue-esign";
import vant from 'vant'
import ElementPlus from 'element-plus'
import  Vue3Esign  from 'vue3-esign'
import VueSignaturePad from "vue-signature-pad";
import VueQuillEditor from 'vue-quill-editor'
import Vue3QrReader from 'vue3-qr-reader';
import 'amfe-flexible'
import '../messages.css'
// import VueQrcodeReader from 'vue-qrcode-reader'
import VueCookies from "vue-cookies";

import { QrStream, QrCapture, QrDropzone } from 'vue3-qr-reader';
export default {
  components: {
    QrStream,
    QrCapture,
    QrDropzone
  },
};
window.$ = $;
const app = createApp(App);
app.use(router)
const pinia = createPinia()
app.use(pinia.use(piniaPluginPersist))
app.use(pinia)
app.use(VueQuillEditor);
app.use(VueSignaturePad);
app.use(ElementPlus,{locale})
app.use(vueEsign);
app.use(Vue3QrReader)
// if (navigator.onLine) {
//   import('vue-qrcode-reader').then(({ default: VueQrcodeReader }) => {
//     app.use(VueQrcodeReader);
//   });
// } else {
//   // 离线状态下预加载组件
//   import('vue-qrcode-reader').then(({ default: VueQrcodeReader }) => {
//     app.use(VueQrcodeReader);
//   });
// }
app.use(vant)
app.use(Vue3Esign)
app.use(Varlet)
app.use(VueCookies)
// app.use(VueQuillEditor);
app.mount('#app')
app.config.globalProperties.$cookies = VueCookies
pinia.use(({ store }) => {
    if (store.$id === 'main') {
      store.restoreState();
    }
  });

